<template>
    <div class="neovisTest">
        <div id="viz" style="width: 250px;height: 500px;box-shadow: 0px 0px 5px #000000;">
        </div>
    </div>
</template>

<script>
    import Neovis from "neovis.js/dist/neovis";

    export default {
        name: "neovisTest",
        props: {
            neovistest: Object,
        },
        data() {
            return {
                viz: '',
                config: {
                    container_id: "viz",
                    server_url: "bolt://zora.fun:7687",
                    server_user: "neo4j",
                    server_password: "WWWWZH",
                    labels: {
                        "Entity": {
                            "caption": "content",
                            "size": "pageranks",
                            "font": {
                                "size": 26,
                                "color": "#000000"
                            },
                            "title_properties": [
                                "content",
                                "points"
                            ],
                            //"image": 'https://visjs.org/images/visjs_logo.png',
                            // "community": "community"
                            //"sizeCypher": "MATCH (n) WHERE id(n) = {id} MATCH (n)-[r]-() RETURN sum(r.weight) AS c"
                        }
                    },
                    relationships: {
                        "ENTITYRELATION": {
                            "thickness": "weight",
                            "caption": "type"
                        },
                    },
                    initial_cypher: ''
                }
            }
        },
        methods: {
            draw() {
                this.config.initial_cypher = "MATCH (n:Entity)-[m:ENTITYRELATION]->(r) where n.userId=" + this.neovistest.userId + " and n.articleId=" + this.neovistest.articleId + " and n.paragraphsId=" + this.neovistest.paragraphsId + " RETURN *"
                this.viz = new Neovis(this.config);
                this.viz.render();
                console.log(this.viz);
                console.log(this.neovistest)
            }

        },
        mounted() {}
    }
</script>

<style scoped>
    .neovisTest {}
</style>